﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EngineAdmin;
using GameEngine;

namespace DaphneProfiBase
{
    /// <summary>
    /// Container class for passing new game form settings
    /// </summary>
    public class NewGameFormSettings
    {
        public enumGameType CheckersType
        { get; set; }

        public bool Suicidal
        { get; set; }

        public bool OnePlayerGame
        { get; set; }

        public bool WhiteTurn
        { get; set; }
    }

    /// <summary>
    /// Container class for settings of the new match
    /// </summary>
    [Serializable]
    public class RunMatchSettings
    {
        public enumGameType CheckersType
        { get; set; }

        public int Rounds
        { get; set; }

        public EngineConfig WhiteEngine
        { get; set; }

        public EngineConfig BlackEngine
        { get; set; }
    }

    /// <summary>
    /// Container class containting information for the output window of engine match
    /// </summary>
    public class InfoEngineMatch
    {
        public enumGameType CheckersType
        { get; set; }

        public int RoundsPassed
        { get; set; }

        public int RoundsTotal
        { get; set; }

        public int WhiteWins
        { get; set; }

        public int BlackWins
        { get; set; }

        public int Draws
        { get; set; }

        public EngineConfig WhiteEngineConfig
        { get; set; }

        public EngineConfig BlackEngineConfig
        { get; set; }

        public EngineMoveOutput WhiteEngineOutput
        { get; set; }

        public EngineMoveOutput BlackEngineOutput
        { get; set; }
    }

    /// <summary>
    /// Checkers Type Helper Class
    /// </summary>
    public static class CheckersTypeHelper
    {
        public static ComputerEngine.eCheckersType ToComputerType(this enumGameType type)
        {
            switch (type)
            {
                case enumGameType.Czech:
                    return ComputerEngine.eCheckersType.CzechCheckers;
                case enumGameType.English:
                    return ComputerEngine.eCheckersType.EnglishCheckers;
                case enumGameType.International:
                    return ComputerEngine.eCheckersType.InternationalCheckers;
                default:
                    throw new ApplicationException("Unkwnown checkers type");
            }
        }

        public static enumGameType ToGameEngineType(this ComputerEngine.eCheckersType type)
        {
            switch (type)
            {
                case ComputerEngine.eCheckersType.CzechCheckers:
                    return enumGameType.Czech;
                case ComputerEngine.eCheckersType.EnglishCheckers:
                    return enumGameType.English;
                case ComputerEngine.eCheckersType.InternationalCheckers:
                    return enumGameType.International;
                case ComputerEngine.eCheckersType.Unknown:
                    return enumGameType.Czech;
                default:
                    throw new ApplicationException("Unkwnown checkers type");
            }
        }
    }

    /// <summary>
    /// Container class for filter selection of PDN Library Dialog
    /// </summary>
    public class PDNLibraryFilter : Dictionary<string, string>
    {
        public PDNLibraryFilter()
            : base()
        {
        }
    }
}
